package com.shop.mms_client.db.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.shop.mms_client.model.Message;

import java.util.List;

@Dao
public interface MessageDao {
    @Insert
    void insert(Message message);

    @Update
    void update(Message message);

    @Query("SELECT * FROM messages ORDER BY timestamp DESC")
    LiveData<List<Message>> getAllMessages();

    @Query("SELECT * FROM messages WHERE isSpam = 1 ORDER BY timestamp DESC")
    LiveData<List<Message>> getSpamMessages();
} 